home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLSRC.PAK / CLIPVIEW.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  2.2 KB  |  125 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1992, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.5  $
  6. //
  7. // Implementation of class TClipboardViewer, a TWindow mixin that allows a
  8. // window to receive clipboard notifications appropriate for being a viewer
  9. //----------------------------------------------------------------------------
  10. #include <owl/pch.h>
  11. #if !defined(OWL_CLIPVIEW_H)
  12. # include <owl/clipview.h>
  13. #endif
  14.  
  15. OWL_DIAGINFO;
  16.  
  17. //
  18. // We only want to search this mixin for events, so don't include any base
  19. // classes in Find()
  20. //
  21. DEFINE_RESPONSE_TABLE(TClipboardViewer)
  22.   EV_WM_CHANGECBCHAIN,
  23.   EV_WM_DESTROY,
  24.   EV_WM_DRAWCLIPBOARD,
  25. END_RESPONSE_TABLE;
  26.  
  27. IMPLEMENT_CASTABLE(TClipboardViewer);
  28.  
  29. //
  30. // Rely on TWindow's default ctor since we will always be mixed-in and another
  31. // window will perform Init()
  32. //
  33. TClipboardViewer::TClipboardViewer()
  34. {
  35.   HWndNext = 0;
  36. }
  37.  
  38. //
  39. //
  40. //
  41. TClipboardViewer::TClipboardViewer(THandle handle, TModule* module)
  42. :
  43.   TWindow(handle, module)
  44. {
  45. }
  46.  
  47. //
  48. //
  49. //
  50. TEventStatus
  51. TClipboardViewer::DoChangeCBChain(THandle hWndRemoved, THandle hWndNext)
  52. {
  53.   if (hWndRemoved == HWndNext)
  54.     HWndNext = hWndNext;
  55.  
  56.   else
  57.     ForwardMessage(HWndNext);
  58.   return esComplete;
  59. }
  60.  
  61. //
  62. //
  63. //
  64. TEventStatus
  65. TClipboardViewer::DoDrawClipboard()
  66. {
  67.   if (HWndNext)
  68.     ForwardMessage(HWndNext);
  69.   return esPartial;
  70. }
  71.  
  72. //
  73. //
  74. //
  75. TEventStatus
  76. TClipboardViewer::DoDestroy()
  77. {
  78.   ::ChangeClipboardChain(GetHandle(), HWndNext);
  79.   return esPartial;
  80. }
  81.  
  82. //
  83. //
  84. //
  85. void
  86. TClipboardViewer::SetupWindow()
  87. {
  88.   HWndNext = ::SetClipboardViewer(GetHandle());
  89. }
  90.  
  91. //
  92. //
  93. //
  94. void
  95. TClipboardViewer::EvChangeCBChain(THandle hWndRemoved, THandle hWndNext)
  96. {
  97.   if (hWndRemoved == hWndNext)
  98.     HWndNext = hWndNext;
  99.  
  100.   else
  101.     ForwardMessage(HWndNext);
  102. }
  103.  
  104. //
  105. //
  106. //
  107. void
  108. TClipboardViewer::EvDrawClipboard()
  109. {
  110.   if (DoDrawClipboard() == esComplete)
  111.     return;
  112.   TWindow::EvDrawClipboard();
  113. }
  114.  
  115. //
  116. //
  117. //
  118. void
  119. TClipboardViewer::EvDestroy()
  120. {
  121.   if (DoDestroy() == esComplete)
  122.     return;
  123.   TWindow::EvDestroy();
  124. }
  125.